import redis
from pymongo import MongoClient

import settings

pool = redis.ConnectionPool(host=settings.REDIS_SERVER, password=settings.REDIS_PASSWORD)

redis_cli = redis.Redis(connection_pool=pool)

mongo_cli = MongoClient(
    host=settings.MONGO_SERVER,
    username=settings.MONGO_USERNAME,
    password=settings.MONGO_PASSWORD,
    authSource=settings.MONGO_AUTH_DATABASE,
)[settings.MONGO_AUTH_DATABASE]


def get_redis_client():
    return redis.Redis(connection_pool=pool)
